<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>
    var obj = {name:"admin", age:18, sex:"男"};
    
    // for(var key in obj){
    //     console.log(key, obj[key]);
    // }

    // object对象的深拷贝
    var obj2 = {};
    for(var key in obj){
        obj2[key] = obj[key];
    }
    obj2.name = "root";

    console.log(obj);
    console.log(obj2);
    console.log(obj === obj2);




    var arr = [3,4,5,6,7];
    // var arr2 = arr.slice(0);
    // var arr2 = arr.concat();
    // ...
    
    var arr2 = [];
    // 数组的深拷贝
    for(var i=0;i<arr.length;i++){
        // arr2[i] = arr[i]
        arr2.push( arr[i] );
    }

    arr2[2] = "hello";

    console.log(arr);
    console.log(arr2);
    console.log(arr === arr2);

</script>
</html>